package com.example.administrator.baikangxing.fragment;


import android.content.Intent;
import android.net.Uri;
import android.nfc.NdefRecord;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.example.administrator.baikangxing.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class ServiceFragment extends BaseFragment implements View.OnClickListener {

    @Override
    public int getContentViewLayoutId() {
        return R.layout.fragment_service;
    }

    @Override
    public void initView() {
        LinearLayout service_ll_custom = findView(R.id.service_ll_custom);
        LinearLayout service_ll_110 = findView(R.id.service_ll_110);
        LinearLayout service_ll_120 = findView(R.id.service_ll_120);
        LinearLayout service_ll_122 = findView(R.id.service_ll_122);
        LinearLayout service_ll_119 = findView(R.id.service_ll_119);
        LinearLayout service_ll_12121 = findView(R.id.service_ll_12121);
        LinearLayout service_ll_114 = findView(R.id.service_ll_114);
        service_ll_custom.setOnClickListener(this);
        service_ll_110.setOnClickListener(this);
        service_ll_120.setOnClickListener(this);
        service_ll_122.setOnClickListener(this);
        service_ll_119.setOnClickListener(this);
        service_ll_12121.setOnClickListener(this);
        service_ll_114.setOnClickListener(this);

    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData() {

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.service_ll_custom:
                callPhone("400-900-5790");
                break;
            case R.id.service_ll_110:
                callPhone("110");
                break;
            case R.id.service_ll_120:
                callPhone("120");
                break;
            case R.id.service_ll_122:
                callPhone("122");
                break;
            case R.id.service_ll_119:
                callPhone("119");
                break;
            case R.id.service_ll_12121:
                callPhone("12121");
                break;
            case R.id.service_ll_114:
                callPhone("114");
                break;
        }
    }

    private void callPhone(String s) {
        Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + s));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }
}
